package com.xueyi.aixihu.reqeust;

import com.xueyi.aixihu.exception.SzException;
import com.xueyi.aixihu.status.SystemCode;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotBlank;

/**
 * @authoer:hxs
 * @createDate:2022/8/18
 * @description: 修改文章所属社区参数
 */
@Data
public class UpdateWxArticleAreaReq {
    /**
     * 微信文章id
     */
    private Integer id;
    @NotBlank(message = "参数异常")
    private String idStr;

    /**
     * 所属社区id
     */
    private Integer cid;
    private String cidStr;

    public void format() throws SzException {
        try {
            this.id = Integer.parseInt(this.idStr.trim());
            if (!StringUtils.isBlank(this.cidStr)) {
                this.cid = Integer.parseInt(this.cidStr.trim());
            }
        } catch (Exception e) {
            throw new SzException(SystemCode.QUERY_CHECK_ERROR, "参数类型错误");
        }
    }
}
